package tron

import (
	"math/big"
)

func GetTrxBalance(account string) (int64, error) {
	c, err := NewClient(GetTrcApiRpcUrl())
	if err != nil {
		return -1, err
	}
	defer c.Close()
	acc, err := c.GetTrxBalance(account)
	if err != nil {
		return -1, err
	}
	return acc.GetBalance(), nil
}

func GetTrc20Balance(account string, contract string) (*big.Int, error) {
	c, err := NewClient(GetTrcApiRpcUrl())
	if err != nil {
		return nil, err
	}
	defer c.Close()
	amount, err := c.GetTrc20Balance(account, contract)
	if err != nil {
		return nil, err
	}
	return amount, nil
}
